// EditObjectCommand.cpp: implementation of the EditObjectCommand class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "EditObjectCommand.h"

#include "application.h"
#include "Project.h"
#include "navigationmanager.h"
#include "BasicCommandRes.h"
#include "ResourceInstance.h"


using namespace PDMS::PDMSUI;
extern NavigationManager* GetMember();
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
namespace PDMS
{
	
	namespace COMMAND
	{
		
		EditObjectCommand::EditObjectCommand()
		{
			
		}
		
		EditObjectCommand::~EditObjectCommand()
		{
			
		}

		BOOL EditObjectCommand::Execute()
		{
			CResourceInstance rs;

			if( Application::Instance()->ActiveProject() == NULL )
			{
				CString strTemp = "";
				strTemp.LoadString( IDC_WARRING_NOPROJECT );
				AfxMessageBox( strTemp );
				return FALSE;
			}

			UeDbObject* curObject = NULL; 
			UeObjectId curID = Application::Instance()->AcitveObject();
			Application::Instance()->ActiveProject()
				->GetCurDatabase()->GetObject(curID,curObject);
			
			ASSERT(curObject);

			UESoft::ErrorStatus es = curObject->SetParam();
			curObject->Close();
			if ( es == UESoft::eOk )
			{
				GetMember()->Updata();
			}
			
			return TRUE;
		}
	}
}